package m202405.d12;

/**
 * @@author: 爱做梦的锤子
 * @date: 2024/5/12 15:05
 */
public class Q206 {
    public ListNode reverseList(ListNode head) {
        ListNode p = head;
        ListNode rs = new ListNode(-1);
        while (p != null) {
            ListNode temp = p;
            p = p.next;
            temp.next = rs.next;
            rs.next = temp;
        }
        return rs.next;
    }
}
